package com.tiger.cloud.model.crm;

import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;

import com.tiger.cloud.security.EncodeUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.tiger.cloud.common.mybatis.TigerBaseEntity;
import com.tiger.cloud.enums.DeleteEnum;
import com.tiger.cloud.enums.LoanRecordType;

import io.swagger.annotations.ApiModelProperty;
/**
 * 
 * crm_loan_info-借款信息表
 *
 */
public class LoanInfo extends TigerBaseEntity{

	private static final long serialVersionUID = 1L;
    
	/**
	 * 所属用户
	 */
	@ApiModelProperty(value = "所属用户")
    private Long userId;
	/**
	 * 客户
	 */
	@JsonIgnore
	@ApiModelProperty(value = "客户")
    private Long customerId;
	/**
	 * 借款信息序号
	 */
	@ApiModelProperty(value = "借款信息序号")
    private String loanNo;
	/**
	 * 借款金额
	 */
	@ApiModelProperty(value = "借款金额")
    private BigDecimal amount;
	/**
	 * 借款期限
	 */
	@ApiModelProperty(value = "借款期限")
    private String loanPeriod;
	/**
	 * 借款类型ID
	 */
	@ApiModelProperty(value = "借款类型ID")
    private Long loanTypeId;
	/**
	 * 借款类型
	 */
	@ApiModelProperty(value = "借款类型")
    private LoanRecordType loanType;
	
	/**
	 * 借款目的
	 */
	@ApiModelProperty(value = "借款目的")
    private String loanIntent;
	
	/**
	 * 是否删除, 0:正常,1:删除
	 */
	@ApiModelProperty(value = "是否删除, 0:正常,1:删除")
    private DeleteEnum isDelete;
	/**
	 * 备注
	 */
	@ApiModelProperty(value = "备注")
    private String memo;
    @JsonIgnore
    private String memo_;
	/**
	 * 
	 */
	@ApiModelProperty(value = "")
    private Timestamp createTime;
	/**
	 * 附件
	 */
	@ApiModelProperty(value = "附件")
    private String attachment;
	/**
	 * 
	 */
	@ApiModelProperty(value = "")
    private Timestamp lastUpdateTime;
    
	/**
	 * 扩展参数
	 */
	private List<LoanInfoDetail> loanInfoDetails=new ArrayList<LoanInfoDetail>();
	
    public LoanInfo(){
    
    }
    
    public List<LoanInfoDetail> getLoanInfoDetails() {
		return loanInfoDetails;
	}

	public void setLoanInfoDetails(List<LoanInfoDetail> loanInfoDetails) {
		this.loanInfoDetails = loanInfoDetails;
	}

	public Long getUserId() {
        return this.userId;
    }
    
    public void setUserId(Long userId) {
        this.userId = userId;
    }
    public Long getCustomerId() {
        return this.customerId;
    }
    
    public void setCustomerId(Long customerId) {
        this.customerId = customerId;
    }
    public String getLoanNo() {
        return this.loanNo;
    }
    
    public void setLoanNo(String loanNo) {
        this.loanNo = loanNo;
    }
    public BigDecimal getAmount() {
        return this.amount;
    }
    
    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }
    public String getLoanPeriod() {
        return this.loanPeriod;
    }
    
    public void setLoanPeriod(String loanPeriod) {
        this.loanPeriod = loanPeriod;
    }
    public Long getLoanTypeId() {
        return this.loanTypeId;
    }
    
    public void setLoanTypeId(Long loanTypeId) {
        this.loanTypeId = loanTypeId;
    }
    public LoanRecordType getLoanType() {
        return this.loanType;
    }
    
    public void setLoanType(LoanRecordType loanType) {
        this.loanType = loanType;
    }
    public DeleteEnum getIsDelete() {
        return this.isDelete;
    }
    
    public void setIsDelete(DeleteEnum isDelete) {
        this.isDelete = isDelete;
    }
    public String getMemo_() {
        if(null == memo){
            return null;
        }
        try {
            return EncodeUtil.urlEncode(memo);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        };
        return null;
    }
    
    public void setMemo_(String memo_) {
        if (null == memo_) {
            return;
        }
        try {
            this.memo= EncodeUtil.urlDecode(memo_);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        };
    }

    public String getMemo() {
        if(null == memo){
            return null;
        }
        try {
            return EncodeUtil.urlDecode(memo);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        };
        return null;
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }
    public Timestamp getCreateTime() {
        return this.createTime;
    }
    
    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }
    public String getAttachment() {
        return this.attachment;
    }
    
    public void setAttachment(String attachment) {
        this.attachment = attachment;
    }
    public Timestamp getLastUpdateTime() {
        return this.lastUpdateTime;
    }
    
    public void setLastUpdateTime(Timestamp lastUpdateTime) {
        this.lastUpdateTime = lastUpdateTime;
    }
    
	public String getLoanIntent() {
		return loanIntent;
	}

	public void setLoanIntent(String loanIntent) {
		this.loanIntent = loanIntent;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
}